package com.hiwhitley.easy.day07;

import com.hiwhitley.base.TreeNode;

/**
 * Created by hiwhitley on 2016/8/11.
 */
public class MaxDepth {
    public int maxDepth(TreeNode root) {
        if (root == null)
            return 0;
        int left = 0, right = 0;
        if (root.left != null) {
            left = maxDepth(root.left);
        }

        if (root.right != null) {
            right = maxDepth(root.right);
        }

        return Math.max(left, right) + 1;

    }

    public static void main(String[] args) {

    }
}
